# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2019-2020 Intel Corporation

[Unit]
Description=Open vSwitch Internal Unit
After=syslog.target
PartOf=openvswitch.service
Wants=openvswitch.service

[Service]
Type=oneshot
RemainAfterExit=yes

ExecStart=/usr/sbin/modprobe uio_pci_generic
ExecStart=/usr/local/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd start
ExecStart=/usr/local/bin/ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true
ExecStart=/usr/local/bin/ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket_mem={{ iac_ovs_socket_mem }}
ExecStart=/usr/local/bin/ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask={{ iac_ovs_cores_hex }}
{% for port in ovs_ports %}
ExecStart={{ ansible_local["dpdk"]["_dpdk_install_dir"] }}/usertools/dpdk-devbind.py --bind=igb_uio {{ port }}
{% endfor %}
ExecStart=/usr/local/share/openvswitch/scripts/ovs-ctl --no-ovsdb-server --db-sock=/usr/local/var/run/openvswitch/db.sock start

ExecStop=/usr/local/share/openvswitch/scripts/ovs-ctl stop
ExecStop=/usr/sbin/modprobe -r uio_pci_generic
